<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/global/global-head.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>吉车惠后台管理系统</title>
	<%@include file="/global/global-other.jsp" %>
	<script type="text/javascript">
		var $bn_oilStaion_map = new Object();
		var $bn_oilStaion_map_Datagrid;
		var viewDialog_map = null;
		$(function(){
			$("#oilStationName").click(function(){
				openOilStation();
			});
		});
		$(function() {
			submitForm = function($dialog,$grid){
				$('#an_car_form').form('submit',{
					url:'${ctx}/bn/ref/insert',
					queryParams:{_m:'exec'},
					onSubmit:function(){
						if($(this).form('enableValidation').form('validate')){
							return true;
						}else{
							return false;
						}
					},
					success:function(data){
						var json =  eval("(" +data+ ")");
							var errcode = json.errcode;
							var errmsg = json.errmsg;
							if(errcode == '1'){
								$.messager.alert("提示",errmsg,"error");
							}else{
								$.messager.alert("提示","保存成功！","info",function(){
									$dialog.dialog('destroy');
									$grid.datagrid('reload');
								});
							}
					}
				});
			};
		});
		function openOilStation(){
			viewDialog_map=parent.$.dialog({
				title: '选择油卡',
				href: '${ctx}/bn/ref/search?_m=showOilStation&r='+Math.random(),
				width: 1000,
				height: 600,
				//bodyStyle: {overflow: 'auto'},
				buttons: [{
					text: '保 存',
					width:'70px',
					iconCls: 'icon-ok',
					handler: function(){
						viewDialog_map.find('iframe').get(0).contentWindow.submitForm(viewDialog_map,$bn_oilStaion_map);
					}
				},{
					text: '关 闭',
					width:'70px',
					iconCls: 'icon-close',
					handler: function(){
						viewDialog_map.close();
					}
				}]
			});
			parent.$.messager.progress('close');
		}
		$bn_oilStaion_map.setOilStation = function(oilStationId,oilStationName){
			$("#oilStationId").val(oilStationId);
			$("#oilStationName").val(oilStationName);

		}
		function closeWin(){
			$("#viewDialog_map").window("close"); ;
		}
	</script>
</head>
<body>
<div class="form-box">
	<div class="form-body">
		<form role="form" name="an_car_form" id="an_car_form" class="easyui-form form form-horizontal" data-options="novalidate:true" method="post">
			<div class="seg-title">
				<div class="seg-title-box">
					<ul>
						<li class="seg-title-box-icon" ><img src="${ctx }/assets/images/communication.gif"/></li>
						<li class="seg-title-box-text">基本信息</li>
						<input type="hidden" id="oilStationId" name="oilStationId" value="">
						<input type="hidden" id="deviceId" name="deviceId" value="${BnRefOilStationDeviceEntity.deviceId}">
						<input type="hidden" id="deviceSn" name="deviceSn" value="${BnRefOilStationDeviceEntity.deviceSn}">
					</ul>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">
					<p class="label-txt">设备SN：</p>
					<p class="star">*</p>
				</label>
				<div class="col-sm-3">
					<input type="text" value="${BnRefOilStationDeviceEntity.deviceSn}" class="form-control easyui-validatebox" style="width:100%;height:34px;line-height:34px;" required="required" validType="length[1,10]" disabled="disabled" >
				</div>
				<label class="col-sm-2 control-label">
					<p class="label-txt">加油站：</p>
					<p class="star">*</p>
				</label>
				<div class="col-sm-3">
					<input type="text"  placeholder="点击选择加油站" id="oilStationName" name="oilStationName"  class="form-control easyui-validatebox" style="width:100%;height:34px;line-height:34px;" required="required" validType="length[1,10]">
				</div>
			</div>
		</form>
	</div>
</div>
</body>
</html>